package memberdemo;

/**
 * 演示类的成员变量和成员方法使用示例
 */
public class MemberDemo {
    public static void main(String[] args) {
        System.out.println("=== 类的成员变量和成员方法演示 ===\n");
        
        // 演示静态成员变量和静态方法
        System.out.println("1. 类成员(静态成员)演示:");
        System.out.println("   默认名称: " + DemoClass.DEFAULT_NAME);
        System.out.println("   默认年龄: " + DemoClass.DEFAULT_AGE);
        DemoClass.printClassInfo();
        System.out.println();
        
        // 演示构造方法和实例成员变量
        System.out.println("2. 实例成员变量和构造方法演示:");
        DemoClass person1 = new DemoClass(); // 使用默认构造方法
        DemoClass person2 = new DemoClass("张三", 25); // 使用带参构造方法
        DemoClass person3 = new DemoClass("李四", 30, false); // 使用完整构造方法
        
        System.out.println("   创建了 " + DemoClass.getInstanceCount() + " 个实例");
        System.out.println("   person1: " + person1);
        System.out.println("   person2: " + person2);
        System.out.println("   person3: " + person3);
        System.out.println();
        
        // 演示Getter方法
        System.out.println("3. Getter方法演示:");
        System.out.println("   person2.getName(): " + person2.getName());
        System.out.println("   person2.getAge(): " + person2.getAge());
        System.out.println("   person2.isActive(): " + person2.isActive());
        System.out.println();
        
        // 演示Setter方法
        System.out.println("4. Setter方法演示:");
        System.out.println("   修改前person1: " + person1.getProfile());
        person1.setName("王五");
        person1.setAge(20);
        person1.setActive(true);
        System.out.println("   修改后person1: " + person1.getProfile());
        System.out.println();
        
        // 演示业务逻辑方法
        System.out.println("5. 业务逻辑方法演示:");
        person2.birthday();
        person3.activate();
        System.out.println("   person3当前状态: " + person3.getProfile());
        person3.deactivate();
        System.out.println("   person3当前状态: " + person3.getProfile());
        System.out.println();
        
        // 演示toString方法
        System.out.println("6. toString方法演示:");
        System.out.println("   person1.toString(): " + person1.toString());
        System.out.println("   person2.toString(): " + person2.toString());
        System.out.println("   person3.toString(): " + person3.toString());
        System.out.println();
        
        System.out.println("=== 演示完成 ===");
    }
}